;;;   -*- Syntax: Common-Lisp; Package: USER; Base: 10; Mode: LISP -*-    ;;;
;;;                                                                       ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(in-package :user)

(proclaim '(optimize (compilation-speed 3) (safety 3) (speed 2)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Modified: Fri Aug 21 14:43:44 EDT 1992
;;; cleaning up and moving completely to defsystem. 
;;; defsystem for audio formatting language.
;;; Modified: Thu Aug 13 10:07:55 EDT 1992
;;; Introducing package audio-formatting-language


;;; make needed packages.
(unless (find-package :dectalk)
  (make-package :dectalk :use '(lisp )))

#+lucid 
(unless (find-package 'afl)
  (make-package 'afl :use '(lisp    lucid lcl dectalk clos make
                            )))
#+(and pcl clisp)
(unless (find-package 'afl)
  (make-package 'afl :use '(lisp    dectalk pcl  make)))
#+(and clos clisp) 
(unless (find-package 'afl)
  (make-package 'afl :use '(lisp    dectalk clos  make)))

;;; Variable: *AFL-PATHNAME*                                 Author: raman
;;; Created: Fri Aug  7 17:34:12 1992

(defvar *afl-pathname*
  (concatenate 'string *lisp-code-directory*  "/" "afl")
  "source code resides here")


;;; Modified: Sat Mar 27 20:08:46 EST 1993
;;; At present need to recompile the speech space method for
;;; local-set-state   after loading the total space.
;;; This is because the local-set-state method for component spaces
;;; needs to refer to the structure accessors defined in total-space.

;;; Modified: Tue Mar 23 12:31:30 EST 1993
;;; adding pronounce module here.
;;; pronounce module used to be in read-aloud.
;(setq *announce* nil)
(defsystem afl
  :source-pathname *afl-pathname*
  :package afl
  :initially-do (announce  "loading afl")
  :finally-do (progn  (announce  "done loading afl")
                      (pushnew :afl *features*)
                      )
  :components (
               (:module "total-space-structure"
                        :source-pathname "total-space"
                        :components(
                                    (:file "total-space-state" )))
               (:module "pronounce" :source-pathname "pronounce"
                        :components(
                                    (:file "pronounce")
                                    (:file "pronunciations"
                                           :depends-on
                                           ("pronounce"))
                                    (:file "french-pronunciations"
                                           :depends-on ("pronounce" ))
                                    (:file  "interface-pronounce"
                                            :depends-on( "pronounce"))
                                    )
                        :depends-on ("speech-component"))
               (:module "speech-component"
                        :source-pathname ""
                        :finally-do (when
                                        *announce*
                                      (funcall
                                       (find-symbol
                                        "INITIALIZE-SPEECH-SPACE"
                                        "AFL")))
                        :components( 
                                    (:file "reference-variables")
                                    (:file "global-variables")
                                    (:file "01-speech-space"
                                           :depends-on( "reference-variables"
                                                        "global-variables"
                                                        "05-block-structure"))
                                    (:file "02-user-definitions"
                                           :depends-on( "reference-variables"
                                                        "global-variables" "01-speech-space"
                                                        "07-final-scaling"))
                                    (:file "03-standard-voice-definitions")
                                    (:file "04-moving-in-speech-space")
                                    (:file "05-block-structure" )
                                    (:file "06-synthesizer-codes")
                                    (:file "dectalk-specific-code")
                                    (:file "07-final-scaling")
                                    )
                        )
                                        ; sound audio  was earlier a separate system
                                        ; now becomes a module
               (:module  "sound-audio"
                         :source-pathname "sound-audio"
                         :package afl 
                         :finally-do
                         (progn
                           (pushnew  :sound-audio *features* )
                           (when *announce*
                             (funcall
                              (find-symbol
                               "INITIALIZE-AUDIO-SPACE" "AFL")))
                           (announce "loaded sound audio"))
                         :components(
                                     (:file "point-in-audio-space")
                                     (:file "define-point-in-audio-space"
                                            :depends-on ("point-in-audio-space"))
                                     (:file "audio-player"
                                            :depends-on ("define-point-in-audio-space"))
                                     ))
               (:module "total-space"
                        :source-pathname "total-space"
                        :finally-do (progn
                                      (when *announce*
                                        (funcall
                                         (find-symbol
                                          "INITIALIZE-TOTAL-SPACE"
                                          "AFL"))))
                        :components (
                                     (:file "total-space-state")
                                     (:file "initialize-total-space"
                                            :depends-on
                                            ("total-space-state"))
                                     (:file "assignments")
                                     )
                        :depends-on ( "pronounce" "speech-component"
                                      "sound-audio"))
               )
  :depends-on (dectalk   )
  )

;;; Variable: *AFL-SOURCE-FILES*                             Author: raman
;;; Created: Sat Aug 15 11:37:38 1992

(defvar *afl-source-files* nil "list of afl source files")

(setf *afl-source-files* (list
                          "reference-variables"
                          "global-variables"
                          "01-speech-space"
                          "02-user-definitions"
                          "03-standard-voice-definitions"
                          "04-moving-in-speech-space"
                          "05-block-structure"
                          "06-synthesizer-codes"
                          "07-final-scaling"
                          ))



;;; Variable: *AFL-DOC-FILE*                                 Author: raman
;;; Created: Sat Aug 15 13:59:47 1992

(defvar *afl-doc-file*
  "/usr/u/raman/lisp-code/afl/user-manual-for-afl.txt"
  "filename where user manual for afl is kept")

;;; Function: CREATE-AFL-USER-MANUAL                                Author: raman
;;; Created: Sat Aug 15 13:59:16 1992

(defun create-afl-user-manual () 
  "Create user manual for afl"
  (with-open-file (out-stream *afl-doc-file* :direction :output)
    (dolist
        (file *afl-source-files*)
      (setf file (concatenate 'string
                              file ".lisp"))
      (create-user-manual file :output-stream out-stream)
      ))
  )


;;; Variable: *AFL-EXTERNAL-DOC-FILE*                        Author: raman
;;; Created: Thu Sep 10 15:24:20 1992

(defvar *afl-external-doc-file*
  "/usr/u/raman/lisp-code/afl/external-afl-user-manual.txt"
  "external user manual")
(defun create-external-afl-user-manual () 
  "Create user manual for afl"
  (with-open-file (out-stream *afl-external-doc-file* :direction :output)
    (dolist
        (file *afl-source-files*)
      (setf file (concatenate 'string
                              file ".lisp"))
      (create-external-user-manual file :output-stream out-stream
                                   :package :afl)
      ))
  )



;;; Function: GENERATE-LIST-OF-FILES                         Author: raman
;;; Created: Wed Aug 19 15:42:10 1992

(defun generate-list-of-files (system-name) 
  "given system name finds it and extracs the file names"
  (let*
      ((files nil)
       (system (find-system   'system-name ))
       (list-of-components (component-components system )))
                                        ;(make-pathname  :directory  (component-source-root-dir (first
                                        ;*l*)) 
                                        ;:name 
                                        ;(component-source-pathname (first *l*))
                                        ;:type (component-source-extension (first *l*))
                                        ;)
    )
  )


(pushnew :afl *features*) 


